﻿using FluentNHibernate.Mapping;
using TheBlog.NhibernateModel.Entities;

namespace TheBlog.NhibernateModel.Mappings
{
    public class ArgeLogRevInfoMap : ClassMap<ArgeLogRevInfo>
    {
        public ArgeLogRevInfoMap()
        {
            Id(p => p.RevNum);
         
            Version(p => p.Version).Generated.Never();
            ////Cache.NonStrictReadWrite();
            Map(p => p.UserId);
            Map(p => p.RawUrl).Length(10000);
            Map(p => p.RevDate);
            Map(p => p.Ip);
            Map(p => p.Controller);
            Map(p => p.Action);
            Map(p => p.SessionId);
            Map(p => p.BrowserInfo);
            
            HasMany(c => c.ModifiedEntityNames)
                .AsSet()
                .Element("EntityName")
                .Table("ArgeLogRevChangeEntities")
                .ForeignKeyConstraintName("FK_ArgeLogRevInfo_ModifiedEntityName_ArgeLogRevId")
                .KeyColumn("ArgeLogRevId");

        }
    }
}